import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;

// 票类
class Ticket implements Serializable {
    private String ticketId;
    private Screening screening;
    private List<String> seats; // 格式: ["1-3", "1-4"]
    private double totalPrice;
    private LocalDateTime purchaseTime;
    private boolean refunded;

    public Ticket(Screening screening, List<String> seats, double totalPrice) {
        this.ticketId = UUID.randomUUID().toString();
        this.screening = screening;
        this.seats = seats;
        this.totalPrice = totalPrice;
        this.purchaseTime = LocalDateTime.now();
        this.refunded = false;
    }

    // 退票
    public boolean refund() {
        if (refunded) return false;
        refunded = true;
        return true;
    }

    // Getters
    public String getTicketId() { return ticketId; }
    public Screening getScreening() { return screening; }
    public List<String> getSeats() { return seats; }
    public double getTotalPrice() { return totalPrice; }
    public LocalDateTime getPurchaseTime() { return purchaseTime; }
    public boolean isRefunded() { return refunded; }
}
